package com.mopencode.seckill.controller;

import com.lxs.legou.core.controller.BaseController;
import com.mopencode.seckill.po.SeckillOrder;
import com.mopencode.seckill.service.SeckillOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mcb
 * @date 2022/4/9
 * @apiNote 秒杀订单水平
 */
@RestController
@RequestMapping("/seckillorder")
public class SeckillOrderController extends BaseController<SeckillOrderService, SeckillOrder> {

    @Autowired
    private SeckillOrderService seckillOrderService;

    @RequestMapping("/add")
    public String addOrder(String userId, String time, int goodsId) {
        boolean orderState = seckillOrderService.addOrder(userId, time, goodsId);
        return orderState ? "下单成功" : "订单异常";
    }

}
